﻿using RayDen.Library.Core;

namespace RayDen.RayEngine.Corrector.Samplers
{
    public abstract class BasePrimarySampler : IPrimarySpaceSampler
    {
        protected IRandomProvider rnd;
        protected int pass, width, height;

        protected BasePrimarySampler(IRandomProvider r)
        {
            rnd = r;
        }

        public virtual float GetSample()
        {
            this.TotalSamples++;
            return rnd.NextFloat();
        }

        public virtual float GetNextSample(int index)
        {
            return rnd.NextFloat();
        }

        public virtual float[] RequestSamples(int count)
        {
            var result = new float[count];
            for (int i = 0; i < count; i++)
            {
                result[i] = rnd.NextFloat();
            }
            return result;
        }


        public long TotalSamples { get; set; }

        public int GetPass()
        {
            return pass;
        }


        public void Init(int w, int h)
        {
        }
    }
}